/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package it.coraci.anag.gui.docs.mr;

import it.coraci.anag.db.sql.controllers.IDDocTypeJpaController;
import it.coraci.anag.db.sql.controllers.PersonJpaController;
import it.coraci.anag.db.sql.entities.IDDocType;
import it.coraci.anag.db.sql.entities.Person;
import java.util.List;
import javax.persistence.Persistence;
import javax.swing.DefaultListModel;

/**
 *
 * @author Luca
 */
public class DocTypeListModel  extends DefaultListModel<IDDocType>{
    
    public DocTypeListModel() {
        super();
    }
    
    public void refresh(){
        this.removeAllElements();
        IDDocTypeJpaController cc = new IDDocTypeJpaController(Persistence.createEntityManagerFactory("dbAnagBasePU"));
        List<IDDocType> findIDDocTypeEntities = cc.findIDDocTypeEntities();
            for (IDDocType docType : findIDDocTypeEntities) {
                this.addElement(docType);
            }
    }
    
}
